import { createRouter, createWebHistory } from "vue-router";
import routes from "./routes";

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes,
});
router.beforeEach((to, from, next) => {
  if (to.meta.valTel) {
    console.log(from);
    console.log(from.fullPath);
    if (from.fullPath == "/phonelogin") {
      next();
    } else {
      setTimeout(() => {
        router.replace("/login");
      }, 1200);
    }
  } else {
    next();
  }
});
export default router;
